# Contributor: Jeff Bilyk <jbilyk@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=memcached
pkgver=1.6.15
pkgrel=0
pkgdesc="Distributed memory object caching system"
url="https://memcached.org/"
arch="all"
license="BSD-3-Clause"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="$depends_dev cyrus-sasl-dev libevent-dev libseccomp-dev linux-headers bsd-compat-headers"
install="$pkgname.pre-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://www.memcached.org/files/memcached-$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd
	fix-bsd-headers.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-sasl \
		--enable-sasl-pwdb \
		--enable-seccomp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -m755 -D "$srcdir/$pkgname.initd" \
		"$pkgdir/etc/init.d/$pkgname"
	install -m644 -D "$srcdir/$pkgname.confd" \
		"$pkgdir/etc/conf.d/$pkgname"
}

sha512sums="
00ee15eb7932420a25f3ce973bc7fcc5ba77a514091883f8b4e58ea861073caa91c676c0020f03c768077e20c76f34bca96616be104af3fbc8e7e78303958f3d  memcached-1.6.15.tar.gz
31bd788433b8021ed332f86d291e7f03222ae234520e52ba673b581d5da2adf5656e8f73e8b985df73258dea9b2a1b8ef36195163fe47a92fda59825deedfed4  memcached.confd
11566ce544c3feedbbcca7f87cf21c9d7f7e47c8a0ebdbc0e833ac18a858211c5b00d4128457f957401f6f20453f0cbe902570488133a503c79ee01c102a7c18  memcached.initd
5b1ea6b0be30ca82b914532f698eea9c05eded06b45385b0fc565ee1c241836df36d421e0b86f8fe15876519d5d2e9661e30f8af0d1485b71be3f0896aedf9dd  fix-bsd-headers.patch
"
